package com.ss.android.wenda.c;

import android.view.View;
import android.view.ViewGroup;

import com.ss.android.article.browser.R;
import com.ss.android.article.common.ThumbGridLayout;
import com.ss.android.image.AsyncImageView;
import com.ss.android.image.Image;
import com.ss.android.wenda.model.Answer;

public final class d extends com.ss.android.k.c.b {
    final class a {
        View a;
        AsyncImageView b;
        View c;

        a(View arg2) {

            this.a = arg2;
            this.b = arg2.findViewById(com.ss.android.article.browser.R.id.image);
            this.c = arg2.findViewById(com.ss.android.article.browser.R.id.abp);
        }
    }

    private int c;

    public d(int arg1) {

        this.c = arg1;
    }

    public final View a(ViewGroup arg3) {
        View v0 = android.support.design.a.b(arg3, R.layout.it);
        a v1 = new a(v0);
        v0.setTag(v1);
        return v1.a;
    }

    public final void a(View arg5, int arg6, Object arg7) {
        Object v0 = arg5.getTag();
        Object v1 = ((Answer)arg7).getThumbImageList().get(arg6);
        if(((Image)v1).isLocal()) {
            int v2 = ((ThumbGridLayout)this.a()).getChildWidth();
            ((a)v0).b.a(((Image)v1), v2, v2);
        }
        else {
            ((a)v0).b.setImage(((Image)v1));
        }

        ((a)v0).b.setImage(((Image)v1));
        View v2_1 = ((a)v0).c;
        int v0_1 = ((Image)v1).isGif() ? View.VISIBLE : View.GONE;
        v2_1.setVisibility(v0_1);
    }

    public final void a(Object arg5) {
        int v3 = 8;
        if(this.c == 2) {
            this.c().d(v3);
        }
        else if((arg5 instanceof Answer)) {
            Object v0 = arg5;
            if(((Answer)v0).getThumbImageList() != null && ((Answer)v0).getThumbImageList().size() != 0) {
                this.c().d(0);
                super.a(arg5);
                v0 = ((Answer)v0).getThumbImageList().get(0);
                ((ThumbGridLayout)this.a()).setSingleSize(((Image)v0).width, ((Image)v0).height);
                return;
            }

            this.c().d(v3);
        }
    }

    public final int b(Object arg3) {
        int v0 = 1;
        int v1 = ((Answer)arg3).getThumbImageList().size();
        if(v1 <= 1) {
            v0 = v1;
        }

        return v0;
    }
}

